package javale;
import java.util.*;
class Brand
{
	private String name;

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}
	public Brand(String name)
	{
		this.name=name;
	}
	@Override
	public String toString() {
		return "Brand [name=" + name + "]";
	}
	
}
class Car
{
	private String id;
	private Brand brand;
	public String getId() {
		return id;
	}
	public void setId(String id) {
		this.id = id;
	}
	public Brand getBrand() {
		return brand;
	}
	public void setBrand(Brand brand) {
		this.brand = brand;
	}
	@Override
	public String toString() {
		return "Car [id=" + id + ", brand=" + brand + "]";
	}
	public Car(String id,Brand brand)
	{	this.id = id;
		this.brand = brand;
	}
	
}

public class Main {
	public static void main(String[] args) 
	{Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		Car[] card=new Car[n];
		for(int i=0;i<n;i++)
		{for(int j=0;j<=i;j++)
			{if(card[j]!=card[i])
				
				card[j]=new Car(sc.nextLine(),new Brand(sc.nextLine()));
			else System.out.println(card[j]+" "+"exist");
			}
			
		}
		System.out.println(Arrays.toString(Car.class.getConstructors()));
		
		
	}

}
